<?php
session_start();
//ct 2009-01-29 Added class _subpath

// set PAGETYPE
$PAGETYPE='LIST';

// includes
	include_once "%connectinclude%";
	include_once "%class_subpath%CF_pdo_com.php";
	include_once "%class_subpath%CF_multiform.php";
	include_once "%fieldinclude%";

// define custom class from from class (CDivMFormList or similar)
	class %class_name% extends %class_base_name% {
		// set the row limit for this class
		var $default_row_limit = 2;
	
	
	}
// Use class instance
	$%list_table_instance% = new %class_name%($fieldspec, $testtable);
	$%list_table_instance%->set_name('%cs_name%'); // is now redundant
	$%list_table_instance%->set_actionpage("%process_page%");
	$%list_table_instance%->set_selfpage("%list_page%");
	$%list_table_instance%->tablename='%cs_name%';
	
	// uncomment and specify for tables with edit page
	$%list_table_instance%->set_editpage("%edit_page%");
	
	// use get_filter_pvals to store control variables specific to each page.
	// to make custom filters, get the variables with the GetPersistent(varname) function
	//	or GetPagePersistent function for page specific (and take out make_query_filr() and get_filter_vars() altogether
	$%list_table_instance%->get_filter_vals();
	%no_paging%$%list_table_instance%->get_pagination();
	
	$qry_list = "%str_query% " ;
	$qry_list .= %str_qry_filter%;
	$qry_list .= %str_qry_sort% ;
	print $qry_list;
	
	%yes_multiact%$%list_table_instance%->multiselect = false;
	
	%no_paging%$array_list = get_array_limitquery($qry_list, $tableinstance->startat, $tableinstance->numrows );
	%yes_paging%$array_list = get_array_query($qry_list);
	
	$%list_table_instance%->set_valuesarray($array_list);
	$%html_table_name% = $%list_table_instance%->maketable();

	
	?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>%cs_name% list</title>
	<!-- main (default) stylesheet -->
	<link rel="stylesheet" href="%class_subpath%commonctls.css" type="text/css">
	<style type="text/css" media="all">@import "tplcommon/qctstyle.css";</style>	
	<!-- Javascript settings -->
	<script language="javascript"  type="text/javascript">

	//----- AJAX dataSync settings  
	// support functions in ajtable.js
	url_syncval = "%process_page%";
	keyvariables = '%str_key%';
	tablename = '%cs_name%'

	//----- Calendar default settings
	// support functions in CF_bodyjs.js
	// To specify the default date - time shown in the visible calendar fields, specify below
	arShowDateDefault = "%A, %B %e, %Y";
	arShowDateFormat = [];
	// To specify the date - time shown in the visible field, adjust below for specific columns
	// - example - arShowDateFormat['lastdate'] = "%B %e, %Y";
	
	//-----Data validation
	// support functions in CF_bodyjs.js
	// The validateData matches an input value agains a regular expression.  IF it meets, it returns True.  If it fails, it re-sets the value and returns false
	// Provide a regular expression in the array arValRegEx with column as key
	// Provide an error message (to appear on valied validation) to the array arValMsg with column as key
	// remeber to backslash twice (escape backslases) and to put reg-ex between backslashes as in example
	arValRegEx = [];
	// Remember to double-backslash your reg-expressions for the string
	// - example - arValRegEx["effectivedate"] = "\\.*\\b";
	// - example - arValRegEx["starttime"] = "\\d{1,2}:\\d\\d";
	
	arValMsg = [];
	// - example - arValMsg["effectivedate"]= "You have to enter something, anything that matches .* ";
	// - example - arValMsg["starttime"] = "Enter a time (hh:mm)";
	
	</script>
	<!-- yui libraries for ajax sync -->
	<script src="ref-yui/yahoo.js"></script>
	<script src="ref-yui/event.js"></script>
	<script src="ref-yui/connection.js"></script>
	<!-- custom data sync code (ajax) -->
	<script src="%class_subpath%ajtable.js"></script>
	<script src="%class_subpath%CFmultiselect.js"></script>
	<!-- calendar links: stylesheet, main program, language extension and setup-helper -->
	<link rel="stylesheet" type="text/css" media="all" href="jscalendar/calendar-win2k-cold-1.css" title="win2k-cold-1" />
	<script type="text/javascript" src="jscalendar/calendar.js"></script>
	<script type="text/javascript" src="jscalendar/lang/calendar-en.js"></script>
	<script type="text/javascript" src="jscalendar/calendar-setup.js"></script>	
</head>

<body onload="statusPrint('')";>
 <script type="text/javascript" src="%class_subpath%CF_bodyjs.js"></script>
 <div id="Header">
	<?php include "tplcommon/header.php" ?>
</div> <!-- End Header -->

 <div id="Menu">
<?php include "tplcommon/leftmenu.php" ?>
</div> <!-- End Menu -->

<div id="Content">
 
<?php //print $testtable->get_filter_vals();
//print "THIS IS DEBUG STUFF:<BR>\n";
//print_r($testtable->filters);
//print "Session: ";
//print_r($_SESSION);
//print " <br>";
//print "Request: ";
//print_r($_REQUEST);
//print "<br>\nEND DEBUG<br>\n";
 //$testtable->make_query_filter()
 ?>

 <br/>
<?php 
%no_paging%print $%list_table_instance%->pageform . "<br/>";

%no_filter%print $%list_table_instance%->make_filters_box();
 ?>
<br/>

<?php print $%list_table_instance%->maketable() ?>

<br/>
<?php %no_multiact%print $%list_table_instance%->make_apply_all() ?>
<br/>
<table name='multi_act'>
<?php %no_multiact%print $%list_table_instance%->make_multi_act_row() ?>
</table>
<br/>
<table>
<?php print $%list_table_instance%->make_add_box('new') ?>
</table>
<span name="status_text" id="status_text">
Warning - Low JavaScript Fuctionality.  Please Enable Javascript, or (if it is enabled), use a newer browser
</span>
<span name="debug_text" id="debug_text">
Debug Here
</span>
<hr/>
Simple Table Test</br>
<table>
<?php print $simple_text ?>
</table>

</div> <!-- End Content -->

<div id="Footer">
<?php include "tplcommon/footer.php" ?>
</div>
</body>